
const CompressionWebpackPlugin = require("compression-webpack-plugin");
const productionGzipExtensions = ["js", "css"];
const Timestamp = new Date().getTime()
const path = require('path')
const resolve = dir => {
    return path.join(__dirname, dir)
  }
module.exports = {
    configureWebpack:{
       
        plugins: [
            new CompressionWebpackPlugin({
            filename: "[path].gz[query]",
            algorithm: "gzip",
            test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"), //匹配文件名
            threshold: 10240, //对10K以上的数据进行压缩
            minRatio: 0.8,
            deleteOriginalAssets: false //是否删除源文件
            })
        ]
    },
    chainWebpack: config => {
        config.resolve.alias
          .set("@", resolve("src"))
          .set("@assets", resolve("src/assets"))
          .set("@components", resolve("src/components"))
          .set("@base", resolve("baseConfig"))
          .set("@public", resolve("public"));
      },
    publicPath: '/',//打包后的位置(如果不设置这个静态资源会报404)
    outputDir: 'dist',//打包后的目录名称
    assetsDir: 'static',//静态资源目录名称
    productionSourceMap:false,
   /* configureWebpack: config => {
        // 打包编译后修改 js 文件名
        config.output.filename = `assets/js/[name].${Timestamp}.js`;
        config.output.chunkFilename = `assets/js/[name].${Timestamp}.js`;
    },
    css: {
        extract: {
            // 打包编译后修改 css 文件名
            filename: `assets/css/[name].${Timestamp}.css`,
            chunkFilename: `assets/css/[name].${Timestamp}.css`
        }
    },*/
    devServer: {
        disableHostCheck: true,
        hot: true,
        proxy: {
            'ObjectLoggerServer':{
                target:'http://8.136.193.200:8888/'
            },
            '/oa':{
                target:'http://8.136.193.200:8888/'
            },
            '/rootImg':{
                 target:'http://8.136.193.200:8888/'
                //target:'http://8.136.193.200:8888/'
            },
            '/cemetery_ex':{
                target:'http://192.168.1.61:10007/'
            },
            '/bygex_ex':{
                target:'http://192.168.1.61:10023/'
            },
            '/business_ex':{
                target:'http://192.168.1.61:10022/'
            },
            '/cemetery':{
                
                target:'http://60.191.72.66:10088/'
               // target:'http://221.230.150.232:18888/'
                // target:'http://218.92.42.166:15555/'
            },
            '/bygex':{
                
                 //target:'http://58.221.139.174:10055/'
                // target:'http://218.92.42.166:15555/'
               // target:'http://127.0.0.1:10023/'
                target:'http://60.191.72.66:10088/'
              // target:'http://221.230.150.232:18888/'
            },
            '/business':{
                //target:'http://8.136.193.200:8888/'
                //target:'http://8.136.193.200:8888/'
                //target:'http://221.230.150.232:18888/'
              // target:'http://218.92.42.166:15555/'
                 target:'http://60.191.72.66:10088/'
                //target:'http://58.221.139.174:10055/'
               //target:'http://8.136.193.200/'
                // target:'http://218.92.42.166:15555/'
            },
            '/api':{ 
                
               // target:'http://58.221.139.174:10055/'
                //target:'http://58.221.139.174:10055/'
                //target:'http://8.136.193.200:8888/'
                //target:'http://8.136.193.200:8888/'
               // target:'http://8.136.193.200/'
               // target:'https://8.134.93.126/'
                // target:'http://218.92.42.166:15555/'
                 target:'http://60.191.72.66:10088/'

               // target:'https://pyzysz.zjpy.gov.cn:10088/'
               // target:process.env.BASE_URL_API
               //target:'https://8.134.93.126/'
               // target:'http://221.230.150.232:18888/'
            }
        }
        //,https: true
    }
}